﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace EvoBoost.Core
{
	public class CrossValidationStatistics
	{
		private readonly List<double> lossDistribution;
		
		public CrossValidationStatistics(IEnumerable<double> lossDistribution)
		{
			if (lossDistribution == null) throw new ArgumentNullException("lossDistribution");

			this.lossDistribution = new List<double>(lossDistribution);
			this.LossMean = Statistics.CalculateMean(lossDistribution);
			this.LossStdDev = Statistics.CalculateStdDev(lossDistribution);
		}

		public double LossMean { get; private set; }

		public double LossStdDev { get; private set; }

		public ReadOnlyCollection<double> LossForSpecificFold
		{
			get { return this.lossDistribution.AsReadOnly(); }
		}
	}
}